package testClasses;

import utilities.SceneGraphVisitorAdapter2;

import com.jme3.audio.AudioNode;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.SceneGraphVisitorAdapter;
import com.jme3.scene.Spatial;

public class TestTraversal {

	public static void main(String[] args) {
		Node root = new Node("root");
		Node a = new Node("a");
		Node b = new Node("b");
		Node c = new Node("c");
		Node d = new Node("d");
		AudioNode audio = new AudioNode();
		audio.setName("audio");
		
		Spatial a1 = new Geometry("a1");
		Spatial a2 = new Geometry("a2");		
		Spatial b1 = new Geometry("b1");
		Spatial b2 = new Geometry("b2");
		Spatial b3 = new Geometry("b3");

		root.attachChild(a);
		root.attachChild(b);
		root.attachChild(audio);
		b.attachChild(c);
		c.attachChild(d);
		a.attachChild(a1);
		a.attachChild(a2);
		d.attachChild(b1);
		c.attachChild(b2);
		d.attachChild(b3);

		SceneGraphVisitorAdapter2 v = new SceneGraphVisitorAdapter2()        
		{
			@Override
			public void visit(Node searchScope) {
				System.out.println(searchScope.getName());
			}
		};

		System.out.println("DFS");
		root.depthFirstTraversal(v);
		System.out.println("BFS");
		root.breadthFirstTraversal(v);
	}
}
